package com.dyzx.hbb.modules.mtn.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

/**
 * 维修工单主表，记录工单状态、维修类型等
 * @TableName mtn_order
 */
@TableName(value ="mtn_order")
@Data
public class MtnOrder {
    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 工单号（如：WO202508040001）
     */
    private String no;

    /**
     * 关联车辆ID
     */
    private Long vehicleId;

    /**
     * 外部客户ID（若为外部车辆维修）
     */
    private Long customerId;

    /**
     * 销售员ID（若为内部车辆维修）
     */
    private Long salesmanId;

    /**
     * 维护类型（1-常规保养；2-故障维修；3-事故维修）
     */
    private Integer type;

    /**
     * 预计完工时间
     */
    private Long expectedOutTime;

    /**
     * 实际完工时间
     */
    private Long actualOutTime;

    /**
     * 入厂时里程数（单位：公里）
     */
    private Integer totalMileage;

    /**
     * 工单状态（0-待接车；1-维修中；2-待结算；3-已完成；4-已取消）
     */
    private Integer status;

    /**
     * 备注（如客户特殊要求）
     */
    private String remark;

    /**
     * 已付款标志（1-未付款；2-已付款）
     */
    private Integer isPaid;

    /**
     * 总金额（元）
     */
    private Long totalAmt;

    /**
     * 优惠费
     */
    private Long discountAmt;

    /**
     * 创建日期（毫秒级时间戳）
     */
    @TableField(fill = FieldFill.INSERT)
    private Long createDate;

    /**
     * 更新日期（毫秒级时间戳）
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateDate;

    /**
     * 删除标志
     */
    private Integer deleted;

    /**
     * 操作用户编号
     */
    private Long operatorId;

    /**
     * 企业编号
     */
    private Long organId;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        MtnOrder other = (MtnOrder) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getNo() == null ? other.getNo() == null : this.getNo().equals(other.getNo()))
            && (this.getVehicleId() == null ? other.getVehicleId() == null : this.getVehicleId().equals(other.getVehicleId()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getSalesmanId() == null ? other.getSalesmanId() == null : this.getSalesmanId().equals(other.getSalesmanId()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getExpectedOutTime() == null ? other.getExpectedOutTime() == null : this.getExpectedOutTime().equals(other.getExpectedOutTime()))
            && (this.getActualOutTime() == null ? other.getActualOutTime() == null : this.getActualOutTime().equals(other.getActualOutTime()))
            && (this.getTotalMileage() == null ? other.getTotalMileage() == null : this.getTotalMileage().equals(other.getTotalMileage()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getIsPaid() == null ? other.getIsPaid() == null : this.getIsPaid().equals(other.getIsPaid()))
            && (this.getTotalAmt() == null ? other.getTotalAmt() == null : this.getTotalAmt().equals(other.getTotalAmt()))
            && (this.getDiscountAmt() == null ? other.getDiscountAmt() == null : this.getDiscountAmt().equals(other.getDiscountAmt()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getUpdateDate() == null ? other.getUpdateDate() == null : this.getUpdateDate().equals(other.getUpdateDate()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
            && (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId()))
            && (this.getOrganId() == null ? other.getOrganId() == null : this.getOrganId().equals(other.getOrganId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getNo() == null) ? 0 : getNo().hashCode());
        result = prime * result + ((getVehicleId() == null) ? 0 : getVehicleId().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getSalesmanId() == null) ? 0 : getSalesmanId().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getExpectedOutTime() == null) ? 0 : getExpectedOutTime().hashCode());
        result = prime * result + ((getActualOutTime() == null) ? 0 : getActualOutTime().hashCode());
        result = prime * result + ((getTotalMileage() == null) ? 0 : getTotalMileage().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getIsPaid() == null) ? 0 : getIsPaid().hashCode());
        result = prime * result + ((getTotalAmt() == null) ? 0 : getTotalAmt().hashCode());
        result = prime * result + ((getDiscountAmt() == null) ? 0 : getDiscountAmt().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getUpdateDate() == null) ? 0 : getUpdateDate().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode());
        result = prime * result + ((getOrganId() == null) ? 0 : getOrganId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", no=").append(no);
        sb.append(", vehicleId=").append(vehicleId);
        sb.append(", customerId=").append(customerId);
        sb.append(", salesmanId=").append(salesmanId);
        sb.append(", type=").append(type);
        sb.append(", expectedOutTime=").append(expectedOutTime);
        sb.append(", actualOutTime=").append(actualOutTime);
        sb.append(", totalMileage=").append(totalMileage);
        sb.append(", status=").append(status);
        sb.append(", remark=").append(remark);
        sb.append(", isPaid=").append(isPaid);
        sb.append(", totalAmt=").append(totalAmt);
        sb.append(", discountAmt=").append(discountAmt);
        sb.append(", createDate=").append(createDate);
        sb.append(", updateDate=").append(updateDate);
        sb.append(", deleted=").append(deleted);
        sb.append(", operatorId=").append(operatorId);
        sb.append(", organId=").append(organId);
        sb.append("]");
        return sb.toString();
    }
}